home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 4 / Precision Software Applications Silver Collection Volume 4 (1993).iso / new / gmsrc211.arj / VECT.RT < prev   
Text File  |  1993-03-02  |  2KB  |  70 lines

  1. ideal
  2.  
  3. ; In : bx - IRQ
  4. ;      si:di - Routine to setup
  5. ; Out: si:di - Routine retrieved
  6. proc            SetVect
  7.                 pushf
  8.                 cli
  9.                 in      al,0A1h
  10.                 mov     ah,al
  11.                 in      al,21h
  12.  
  13.                 mov     cl,bl
  14.                 mov     dx,1
  15.                 shl     dx,cl
  16.                 not     dx
  17.                 and     ax,dx
  18.                 out     21h,al
  19.                 mov     al,ah
  20.                 out     0A1h,al
  21.  
  22.                 cmp     bx,7
  23.                 jle     @@Add8
  24.                 add     bx,60h
  25. @@Add8:         add     bx,8
  26.                 shl     bx,2
  27.                 push    es
  28.                 xor     ax,ax
  29.                 mov     es,ax
  30.                 push    [Word es:bx]
  31.                 push    [Word es:bx+2]
  32.                 mov     [es:bx],di
  33.                 mov     [es:bx+2],si
  34.                 pop     si di es
  35.                 popf
  36.                 ret
  37. endp            SetVect
  38.  
  39.  
  40. ; In : BX - IRQ to restore
  41. ;      SI:DI - Address to restore to.
  42. proc            RestoreVect
  43.                 pushf
  44.                 cli
  45.                 in      al,0A1h
  46.                 mov     ah,al
  47.                 in      al,21h
  48.                 mov     cl,bl
  49.                 mov     dx,1
  50.                 shl     dx,cl
  51.                 or      ax,dx
  52.                 out     21h,al
  53.                 mov     al,ah
  54.                 out     0A1h,al
  55.                 cmp     bx,7
  56.                 jle     @@Add8
  57.                 add     bx,60h
  58. @@Add8:         add     bx,8
  59.                 shl     bx,2
  60.                 push    es
  61.                 xor     ax,ax
  62.                 mov     es,ax
  63.                 mov     [es:bx],di
  64.                 mov     [es:bx+2],si
  65.                 pop     es
  66.                 popf
  67.                 ret
  68. endp            RestoreVect
  69.  
  70.